package oicon;


import java.util.ArrayList;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JProgressBar;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;

import de.javasoft.plaf.synthetica.SyntheticaBlackEyeLookAndFeel;

public class ProgressBarExample extends JPanel {

  JProgressBar pbar;
  static final int MY_MINIMUM = 0;
  static final int MY_MAXIMUM = 100;

  public ProgressBarExample() {
     pbar = new JProgressBar();
     pbar.setMinimum(MY_MINIMUM);
     pbar.setMaximum(MY_MAXIMUM);
     pbar.setStringPainted(true);
     add(pbar);
  }

  public void updateBar(int newValue) {
    pbar.setValue(newValue);
    if (newValue == 100) System.exit(0);
  }

  public static void main(String args[]) {
	  JFrame.setDefaultLookAndFeelDecorated(true);
	  try {
			UIManager.setLookAndFeel(new SyntheticaBlackEyeLookAndFeel());
			//UIManager.setLookAndFeel(new SyntheticaWhiteVisionLookAndFeel());
			//UIManager.setLookAndFeel(new SyntheticaMauveMetallicLookAndFeel());
			//UIManager.setLookAndFeel(new SyntheticaSkyMetallicLookAndFeel());
		} catch (Exception e3) {
			System.out.println("SystemLookAndFeel failed! BlackEye");
			e3.printStackTrace();
		}
		
     final ProgressBarExample it = new ProgressBarExample();

     JFrame frame = new JFrame("Progress Bar Example");
     frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);   
     frame.setContentPane(it);
     frame.pack();
     frame.setVisible(true);
     frame.setLocation((int)((java.awt.Toolkit.getDefaultToolkit().getScreenSize().width - frame.getWidth()) / 2), (int)((java.awt.Toolkit.getDefaultToolkit().getScreenSize().height - frame.getHeight()) / 2));

     for (int i = MY_MINIMUM; i <= MY_MAXIMUM; i++) {
       final int percent=i;
       try {
         SwingUtilities.invokeLater(new Runnable() {
             public void run() {
               it.updateBar(percent);
             }
         });
         java.lang.Thread.sleep(10);
       } catch (InterruptedException e) {;}
     } 
     
     // substring endup
     /*String source = "EMPLOYEE_DEPT_FK1";
     
     String last = "";// , head = "";
     for (int i = source.length() - 1; i >= 0; i--) {
    	 if (source.charAt(i) == '_') {
    		 last = source.substring(i, source.length());
    		 // head = source.substring(0, i);
    		 // System.out.println(head + last + "\n" + source);
    		 break;
    	 }
     }*/
     ArrayList<String> ttt = new ArrayList<String>();
     ttt.add("COL1 VARCHAR2(50) NULL DEFAULT 'susan'");
     ttt.add("COL2 CHAR(13) NOT NULL");
     ttt.add("COL3 DATE");
     String stmt = "";
     stmt += "ADD CONSTRAINT " + "EMPLOYEE".toUpperCase() + " UNIQUE";
		stmt += "\n";
		stmt += "(";
		for (int i = 0; i < ttt.size(); i++) {
			String colName = ttt.get(i).toUpperCase();
			stmt += ((i != 0) ? ("\n" + ",") : "\n");
			stmt += ((i == 0) ? (" " + colName) : colName);
		}
		stmt += "\n";
		stmt += ")";
		stmt += ";";
     
		System.out.println(stmt);
  }
}
